package com.pacai.varparameter;

public class VarParameter {
    public static void main(String[] args) {
        HspMethod hspMethod = new HspMethod();
        hspMethod.sum(1,2,3,4,5);
        int[] arr = {1,2,3,4,5};
        hspMethod.sum(arr);
    }
}


class HspMethod{
    public int sum(int... n){
        int sum = 0;
        for (int i = 0; i < n.length; i++) {
            sum += n[i];
        }
        return sum;
    }
}
